package com.example.demo.service;

import com.example.demo.bean.Building;
import com.example.demo.bean.Product;
import com.example.demo.dao.ProductDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductService {
    @Autowired
    ProductDao dao;
    public int getCount() {
        return dao.getCount();
    }

    public List<Product> getAllProducts(int page, int limit){
        return dao.getAllProducts(page, limit);
    }

    public int addProduct(Product product){
        return dao.addProduct(product);
    }

    public int delProduct(int id){
        return dao.delProduct(id);
    }

    public int updateProduct(Product product){
        return dao.updateProduct(product);
    }

    public List<Product> findProductByName(int page, int limit, String name){
        return dao.findProductByName(page, limit, name);
    }
    public int getCount(String name){
        return dao.getCount(name);
    }

    public List<Product> getAllProducts() {
        return dao.getAllProducts();
    }
}
